package com.pronosticnews.server.domain.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import fr.ysa.persistence.Entity;

@javax.persistence.Entity
public class Championnat implements Entity {

	private static final long serialVersionUID = 3187897503747860006L;
	
	public static enum VALUE_NAME {
		id, nom, pays, sport, logo
	}
	
	@Transient
	private int hashCode = Integer.MIN_VALUE;

	// primary key
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private java.lang.Integer id;

	private java.lang.String nom;
	
	// many to one
	@ManyToOne(fetch=FetchType.EAGER)
	private Pays pays;
	
	@ManyToOne(fetch=FetchType.EAGER)
	private Sport sport;

	private Integer logo;
	
	// constructors
	public Championnat() {
		initialize();
	}

	public Championnat(java.lang.Integer _id) {
		this.setId(_id);
		initialize();
	}

	public Championnat(java.lang.Integer _id,
			Pays _idPays,
			Sport _idSport, java.lang.String _nom) {

		this.setId(_id);
		this.setPays(_idPays);
		this.setSport(_idSport);
		this.setNom(_nom);
		initialize();
	}

	protected void initialize() {
	}

	public java.lang.Integer getId() {
		return id;
	}

	public void setId(java.lang.Integer id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}
	
	public java.lang.String getNom() {
		return nom;
	}

	public void setNom(java.lang.String nom) {
		this.nom = nom;
	}

	public Pays getPays() {
		return this.pays;
	}

	public void setPays(Pays pays) {
		this.pays = pays;
	}

	public Sport getSport() {
		return this.sport;
	}

	public void setSport(Sport _idSport) {
		this.sport = _idSport;
	}

	@Override
	public List<String> getColumnNameValues() {
		List<String> list = new ArrayList<String>();
		for (VALUE_NAME value : VALUE_NAME.values()) {
			list.add(value.name());
		}
		return list;
	}

	public Integer getLogo() {
		return logo;
	}

	public void setLogo(Integer logo) {
		this.logo = logo;
	}

}